#!/bin/bash
# working two
#USERNAME=wei
#HOSTNAME=gray01
#SCRIPT="ps -fp 19056"
#echo "login to" $HOSTNAME
#ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
#HOSTNAME=gray03
#SCRIPT="ps -fp 48751"
#echo "login to" $HOSTNAME
#ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
#HOSTNAME=gray06
#HOSTNAME=gray07
#SCRIPT="ps -fp 57243"
#echo "login to" $HOSTNAME
#ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
#HOSTNAME=gray10
#SCRIPT="ps -fp 24139"
#echo "login to" $HOSTNAME
#ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
#HOSTNAME=gray12
#SCRIPT="ps -fp 56897; ps -fp 56938"
#echo "login to" $HOSTNAME
#ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
#HOSTNAME=gray13
#SCRIPT="ps -fp 31015; ps -fp 31056"
#echo "login to" $HOSTNAME
#ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
#HOSTNAME=gray14
#SCRIPT="ps -fp 63055; ps -fp 63188"
#echo "login to" $HOSTNAME
#ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
#HOSTNAME=gray15
#SCRIPT="ps -fp 60356;"
#echo "login to" $HOSTNAME
#ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
#HOSTNAME=gray16
#SCRIPT="ps -fp 24684;"
#echo "login to" $HOSTNAME
#ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
#HOSTNAME=gray17
#SCRIPT="ps -fp 19083;"
#echo "login to" $HOSTNAME
#ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
#exit

# working one
USERNAME=wei
HOSTS="gray01 gray02 gray03 gray04 gray05 gray06 gray07 gray09 gray10 gray11 gray12 gray13 gray14 gray15 gray16 gray17"
# HOSTS="gray01 gray02"
# SCRIPT="for PID in ${pgrep -d irtk} ; do echo ${PID} done"
SCRIPT="pgrep -d"," irtk;"
for HOSTNAME in ${HOSTS} ; do
	    echo "login to" ${HOSTNAME}
	    ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
done
exit

USERNAME=wei
#HOSTNAME=gray12
#SCRIPT="cd '/home/vgc/wei/workspace/NYU_IRTK/polyIRToolkit_Wei'; ./fastScript_makeIndexes_20140922.sh ptPowTo0"
#echo "login to" $HOSTNAME
#ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
HOSTNAME=gray06
SCRIPT="cd '/home/vgc/wei/workspace/NYU_IRTK/polyIRToolkit_Wei'; ./fastScript_makeIndexes_20140922.sh ptPowToDot1"
echo "login to" $HOSTNAME
ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
HOSTNAME=gray12
SCRIPT="cd '/home/vgc/wei/workspace/NYU_IRTK/polyIRToolkit_Wei'; ./fastScript_makeIndexes_20140922.sh ptPowToDot3"
echo "login to" $HOSTNAME
ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
HOSTNAME=gray13
SCRIPT="cd '/home/vgc/wei/workspace/NYU_IRTK/polyIRToolkit_Wei'; ./fastScript_makeIndexes_20140922.sh ptPowToDot5"
echo "login to" $HOSTNAME
ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
HOSTNAME=gray14
SCRIPT="cd '/home/vgc/wei/workspace/NYU_IRTK/polyIRToolkit_Wei'; ./fastScript_makeIndexes_20140922.sh ptPowToDot7"
echo "login to" $HOSTNAME
ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
exit

USERNAME=wei
HOSTNAME=gray12
SCRIPT="cd '/home/vgc/wei/workspace/NYU_IRTK/polyIRToolkit_Wei'; ./fastScript_makeIndexes_20140922.sh ptPowTo0"
echo "login to" $HOSTNAME
ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
HOSTNAME=gray13
SCRIPT="cd '/home/vgc/wei/workspace/NYU_IRTK/polyIRToolkit_Wei'; ./fastScript_makeIndexes_20140922.sh ptPowToDot1"
echo "login to" $HOSTNAME
ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
HOSTNAME=gray14
SCRIPT="cd '/home/vgc/wei/workspace/NYU_IRTK/polyIRToolkit_Wei'; ./fastScript_makeIndexes_20140922.sh ptPowToDot3"
echo "login to" $HOSTNAME
ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
HOSTNAME=gray15
SCRIPT="cd '/home/vgc/wei/workspace/NYU_IRTK/polyIRToolkit_Wei'; ./fastScript_makeIndexes_20140922.sh ptPowToDot5"
echo "login to" $HOSTNAME
ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
HOSTNAME=gray16
SCRIPT="cd '/home/vgc/wei/workspace/NYU_IRTK/polyIRToolkit_Wei'; ./fastScript_makeIndexes_20140922.sh ptPowToDot7"
echo "login to" $HOSTNAME
ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
exit

USERNAME=wei
HOSTNAME=gray06
SCRIPT="cd '/home/vgc/wei/workspace/NYU_IRTK/polyIRToolkit_Wei'; ./fastScript_makeIndexes_20140922.sh ptPowTo0"
echo "login to" $HOSTNAME
ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
HOSTNAME=gray07
SCRIPT="cd '/home/vgc/wei/workspace/NYU_IRTK/polyIRToolkit_Wei'; ./fastScript_makeIndexes_20140922.sh ptPowToDot1"
echo "login to" $HOSTNAME
ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
HOSTNAME=gray09
SCRIPT="cd '/home/vgc/wei/workspace/NYU_IRTK/polyIRToolkit_Wei'; ./fastScript_makeIndexes_20140922.sh ptPowToDot3"
echo "login to" $HOSTNAME
ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
HOSTNAME=gray10
SCRIPT="cd '/home/vgc/wei/workspace/NYU_IRTK/polyIRToolkit_Wei'; ./fastScript_makeIndexes_20140922.sh ptPowToDot5"
echo "login to" $HOSTNAME
ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
HOSTNAME=gray11
SCRIPT="cd '/home/vgc/wei/workspace/NYU_IRTK/polyIRToolkit_Wei'; ./fastScript_makeIndexes_20140922.sh ptPowToDot7"
echo "login to" $HOSTNAME
ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
exit

USERNAME=wei
HOSTNAME=gray01
SCRIPT="cd '/home/vgc/wei/workspace/NYU_IRTK/polyIRToolkit_Wei'; ./fastScript_makeIndexes_20140922.sh ptPowTo0"
echo "login to" $HOSTNAME
ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
HOSTNAME=gray02
SCRIPT="cd '/home/vgc/wei/workspace/NYU_IRTK/polyIRToolkit_Wei'; ./fastScript_makeIndexes_20140922.sh ptPowToDot1"
echo "login to" $HOSTNAME
ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
HOSTNAME=gray03
SCRIPT="cd '/home/vgc/wei/workspace/NYU_IRTK/polyIRToolkit_Wei'; ./fastScript_makeIndexes_20140922.sh ptPowToDot3"
echo "login to" $HOSTNAME
ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
HOSTNAME=gray04
SCRIPT="cd '/home/vgc/wei/workspace/NYU_IRTK/polyIRToolkit_Wei'; ./fastScript_makeIndexes_20140922.sh ptPowToDot5"
echo "login to" $HOSTNAME
ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
HOSTNAME=gray05
SCRIPT="cd '/home/vgc/wei/workspace/NYU_IRTK/polyIRToolkit_Wei'; ./fastScript_makeIndexes_20140922.sh ptPowToDot7"
echo "login to" $HOSTNAME
ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
exit


USERNAME=wei
HOSTS="gray01 gray02"
SCRIPT="cd '/home/vgc/wei/workspace/NYU_IRTK/polyIRToolkit_Wei'; pwd"
for HOSTNAME in ${HOSTS} ; do
	    echo "login to" ${HOSTNAME}
	    ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
done

exit
ssh wei@gray17
mkdir testGray17
